export default{
//获取本周、上周日期
getWeekDate(){
	let now = new Date(),
		nowDayOfWeek = now.getDay(),
		params = {
			thisWeek: [],
			lastWeek: []
		};
	if(!nowDayOfWeek){
		nowDayOfWeek = 7;
	}

	let days = [],
		day1 = new Date(now).getTime() - 86400000*(nowDayOfWeek-1),
		day7 = new Date(day1).getTime() + 86400000*6;
	
	for(var i=0; i<14; i++){
		days.push(moment(new Date(day7 - 86400000*i)).format('YYYY-MM-DD'))
	}
	days.reverse();

	days.forEach((e, i) => {
		if(i<7){
			params.lastWeek.push(e)
		}else{
			params.thisWeek.push(e)
		}
	})
	
	return params;
},
//获取本月、上月日期
getMonthDate(){
	let today = new Date(),
		thisMonth = moment(today).format('YYYY-MM'),
		lastMonth = new Date(thisMonth).getTime() - 86400000,
		thisDay = new Date(today.getFullYear(), today.getMonth()+1, 0).getDate(),
		lastDay = new Date(new Date(lastMonth).getFullYear(), new Date(lastMonth).getMonth()+1, 0).getDate(),
		params = {
			thisMonth: [],
			lastMonth: []
		};

	for(let i=1; i<=thisDay; i++){
		params.thisMonth.push(
			moment(today.getFullYear() + '-' + (today.getMonth()+1) + '-' + i).format('YYYY-MM-DD')
		);
	}
	for(let i=1; i<=lastDay; i++){
		params.lastMonth.push(
			moment(new Date(lastMonth).getFullYear() + '-' + (new Date(lastMonth).getMonth()+1) + '-' + i).format('YYYY-MM-DD')
		);
	}
	
	return params;
},
}